//
//  TravelTopicModel.m
//  ToWhere
//
//  Created by dllo on 15/11/14.
//  Copyright © 2015年 www.TE.com. All rights reserved.
//

#import "TravelTopicModel.h"
#import "TravelTopicDetailsModel.h"

@implementation TravelTopicModel

-(void)dealloc
{
    [_ID release];
    [_name release];
    [_image_url release];
    [_title release];
    [_destination_id release];
    [_arr release];
    [super dealloc];
}

-(instancetype)initWithNSDictionary:(NSDictionary *)dic
{
    self =[super init];
    if (self) {
        self.arr = [NSMutableArray array];
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

+(TravelTopicModel *)travelTopicModelinitWithNSDictionary:(NSDictionary *)dic
{
    
    TravelTopicModel *model = [[TravelTopicModel alloc]initWithNSDictionary:dic];
    
    return [model autorelease];
    
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    if ([key isEqualToString:@"id"]) {
        self.ID = value;
    }
    if ([key isEqualToString:@"article_sections"]) {
        NSArray *arrayT = value;
        
        for (NSDictionary *dic in arrayT) {
            
            TravelTopicDetailsModel *model = [TravelTopicDetailsModel travelTopicDetailModelinitWithNSDictionary:dic];
            [self.arr addObject:model];
            
        }
        
        
        
    }
    
}


@end
